<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateServicesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('services', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('shop_id')->default(0)->comment('门店ID');
            $table->integer('cid')->default(0)->comment('分类ID');
            $table->string('image')->nullable()->comment('服务图片');
            $table->string('title')->default('')->comment('服务标题');
            $table->string('subtitle')->nullable()->comment('服务描述');
            $table->decimal('price')->default('0.00')->comment('服务最低价格');
            $table->json('prices')->nullable()->comment('服务价格设置');
            $table->json('member_prices')->nullable()->comment('会员服务价格设置');

//            $table->json('shop_rate')->nullable()->comment("门店分成比例");
//            $table->json('worker_rate')->nullable()->comment("洗车小哥分成比例");
            $table->json('worker_rates')->nullable()->comment("洗车小哥分成比例");
//            $table->json('user_rate')->nullable()->comment("上级用户分成比例");
            $table->json('areas')->nullable()->comment('地区价格与分成设置');
            $table->mediumText('content')->nullable()->comment('图文介绍');
            $table->integer('sort')->default('0')->comment('排序');
            $table->tinyInteger('status')->default('0')->comment('状态:0=正常,1=隐藏');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('services');
    }
}
